Viessmann: read real power and temperature from the API - #32219
Viessmann: read real power and temperature from the API#32219ickeundso wants to merge 5 commits into
Conversation
The Viessmann heat pump template only wired heating.dhw.oneTimeCharge. With no power reading, the loadpoint fell back to the current*phases*230V estimate and displayed a wildly wrong charge power (up to ~11 kW while the compressor draws ~1.3 kW). Charger template: - power: heating.power.consumption.current (real electrical input, kW -> W) - temp: heating.dhw.sensors.temperature.dhwCylinder (domestic hot water) - limittemp: heating.dhw.temperature.main (DHW target) All readers use the single device feature-list endpoint with a shared 120s cache. The Viessmann API has a strict daily request quota (shared with the ViCare app); per-feature polling exhausts it within hours (HTTP 429). evcc's http plugin caches by URL, so identical-URL readers share one request per cache window (~720/day). No energy reading on purpose: the API exposes no monotonic lifetime counter, and with power present evcc integrates energy itself. New meter template (usage: aux) reading the same consumption value, for showing the heat pump in the energy flow without configuring it as a charger. Verified against a live Vitocal 250-A.
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The same Viessmann features URI plus auth block is duplicated multiple times across charger and meter templates; consider extracting this into a shared anchor/include to keep configuration DRY and easier to adjust if the endpoint or auth parameters ever change.
- The meter template exposes a
usageparameter but only allows the fixed valueaux; if no other usage types are expected, you might simplify by inliningusage: auxto avoid an unnecessary configuration option in the UI.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The same Viessmann features URI plus auth block is duplicated multiple times across charger and meter templates; consider extracting this into a shared anchor/include to keep configuration DRY and easier to adjust if the endpoint or auth parameters ever change.
- The meter template exposes a `usage` parameter but only allows the fixed value `aux`; if no other usage types are expected, you might simplify by inlining `usage: aux` to avoid an unnecessary configuration option in the UI.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
The power/temperature data points require the One Base (E3) device generation; the API's feature list is self-describing per installation and older hardware/firmware may not provide them. On such devices the readers would fail every cycle, regressing setups that worked with the plain oneTimeCharge template. Add a `measurements` option (default on) that gates the power/temp/limittemp readers, and document the device dependency with a pointer to the Viessmann developer portal in the template description.
The device feature-list URL was repeated in every reader and command. Compute the device base once from a new advanced `uri` parameter defaulting to https://api.viessmann-climatesolutions.com/iot/v2. Viessmann has moved the API domain before (viessmann.com -> viessmann-climatesolutions.com), so making the base configurable avoids a template change next time and helps with proxy setups.
Existing installations do not carry the new parameter, so on upgrade the default applies to every setup. With the readers enabled by default, devices without the One Base (E3) data points would start failing every cycle. Default to off so upgrades are strictly unchanged and the readings are an explicit opt-in; wording of description and help adjusted accordingly.
In the factory configuration the built-in Heizwasser-Durchlauferhitzer
(electric booster heater) may be activated automatically for hot water
preparation, i.e. also during the boost that evcc triggers. Add a note to
the template description explaining how to prevent that: have the
contractor lock the booster approval for DHW ("Freigabe
Heizwasser-Durchlauferhitzer", per the Vitocal operating instructions) or
select the "Efficient" DHW mode in ViCare where available.
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="templates/definition/charger/viessmann.yaml" line_range="144-153" />
<code_context>
de: normalerweise `0`
en: typically `0`
default: 0
+ - name: measurements
+ required: true
+ type: bool
</code_context>
<issue_to_address>
**issue (bug_risk):** Boolean parameter `measurements` is treated as a string in the template condition, which is likely to misbehave.
The parameter is declared as `type: bool` but evaluated with `{{- if eq .measurements "true" }}`, which assumes a string. This will fail if evcc passes a real boolean (`true`/`false` without quotes). Use a boolean check such as `{{- if .measurements }}` or `{{- if eq .measurements true }}` so the condition matches the declared type and avoids misconfiguration.
</issue_to_address>
### Comment 2
<location path="templates/definition/meter/viessmann.yaml" line_range="38" />
<code_context>
+ en: Gateway Serial
+ help:
+ de: Seriennummer des VitoConnect modul (VitoCare App -> Einstellungen -> Kommunikationsmodul -> Seriennummer)
+ en: VitoConnect serial number (VitoCare App -> Settings -> Communication module -> Serial number)
+ - name: installation_id
+ required: true
</code_context>
<issue_to_address>
**issue (review_instructions):** The wording here uses "VitoCare App", which is inconsistent with other templates that reference the "ViCare" app.
Other templates in the `templates` directory refer to the Viessmann app as "ViCare" (without the extra "to"). Please update both the German and English help texts to use the same app name spelling for consistency with existing templates.
<details>
<summary>Review instructions:</summary>
**Path patterns:** `templates/**/*.yaml`
**Instructions:**
Verify that the changes comply to the rules defined in templates/README.md. Also check consistence (wording) with other files inside templates directory.
</details>
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| - name: measurements | ||
| required: true | ||
| type: bool | ||
| default: false | ||
| description: | ||
| de: Leistungs- und Temperaturwerte auslesen | ||
| en: Read power and temperature values | ||
| help: | ||
| de: Liest die aktuelle elektrische Leistungsaufnahme und die Warmwassertemperatur aus. Aktivieren, wenn das Gerät diese Datenpunkte liefert (One-Base-/E3-Generation, z. B. Vitocal 25x); die Verfügbarkeit lässt sich am Feature-Endpunkt der API ablesen. Standardmäßig deaktiviert, damit sich bestehende Installationen beim Update nicht ändern. | ||
| en: Reads the current electrical power consumption and the domestic hot water temperature. Enable if the device provides these data points (One Base/E3 generation, e.g. Vitocal 25x); availability can be checked via the API feature endpoint. Disabled by default so existing installations are unchanged on upgrade. |
There was a problem hiding this comment.
issue (bug_risk): Boolean parameter measurements is treated as a string in the template condition, which is likely to misbehave.
The parameter is declared as type: bool but evaluated with {{- if eq .measurements "true" }}, which assumes a string. This will fail if evcc passes a real boolean (true/false without quotes). Use a boolean check such as {{- if .measurements }} or {{- if eq .measurements true }} so the condition matches the declared type and avoids misconfiguration.
| en: Gateway Serial | ||
| help: | ||
| de: Seriennummer des VitoConnect modul (VitoCare App -> Einstellungen -> Kommunikationsmodul -> Seriennummer) | ||
| en: VitoConnect serial number (VitoCare App -> Settings -> Communication module -> Serial number) |
There was a problem hiding this comment.
issue (review_instructions): The wording here uses "VitoCare App", which is inconsistent with other templates that reference the "ViCare" app.
Other templates in the templates directory refer to the Viessmann app as "ViCare" (without the extra "to"). Please update both the German and English help texts to use the same app name spelling for consistency with existing templates.
Review instructions:
Path patterns: templates/**/*.yaml
Instructions:
Verify that the changes comply to the rules defined in templates/README.md. Also check consistence (wording) with other files inside templates directory.
Fixes #32303
The Viessmann heat pump template only wired
heating.dhw.oneTimeCharge. With no power reading, the loadpoint falls back to the current×phases×230V estimate and shows a wildly wrong charge power (up to ~11 kW while the compressor actually draws ~1.3 kW).Charger template additions:
power:heating.power.consumption.current— real electrical input power (kW → W)temp:heating.dhw.sensors.temperature.dhwCylinder— domestic hot water temperature on the loadpoint gaugelimittemp:heating.dhw.temperature.main— the device's DHW targetAll readers use the single device feature-list endpoint with a shared 120s cache: the Viessmann API has a strict daily request quota (shared with the ViCare app), and per-feature polling exhausts it within hours (HTTP 429). Since the http plugin caches by URL, identical-URL readers share one request per cache window (~720/day). Deliberately no
energyreading: the API exposes no monotonic lifetime counter, and with power present evcc integrates energy itself.Also adds a meter template (
usage: aux) reading the same consumption value, for showing the heat pump in the energy flow when it is not configured as a charger.The readings are opt-in via a new
measurementsoption, disabled by default: which data points a device provides is device-specific (One Base/E3 generation, e.g. Vitocal 25x — the API's feature endpoint is self-describing), and existing installations must be unchanged on upgrade. The API base URL is consolidated into a single advanceduriparameter (Viessmann has moved the API domain before). The template description now also documents that the factory configuration may activate the built-in booster heater (Heizwasser-Durchlauferhitzer) during hot water preparation, and how to prevent that per the Vitocal operating instructions.Verified against a live Vitocal 250-A.
make docsand template tests pass.Here some screenshot how the heat pump configured with that temple will look like in evcc: